package cg.cmm.rag.config;

import dev.langchain4j.web.search.searchapi.SearchApiWebSearchEngine;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: baibing
 * create time: 2025-03-21 16:33
 * description:
 */

@Configuration
public class WebSearchConfig {
    private final WebSearchProperties webSearchProperties;

    public WebSearchConfig(WebSearchProperties webSearchProperties) {
        this.webSearchProperties = webSearchProperties;
    }

    @Bean
    public SearchApiWebSearchEngine initWebSearchEngine() {
        return SearchApiWebSearchEngine.builder()
                .apiKey(webSearchProperties.getApiKey())
                .engine(webSearchProperties.getEngine()).build();
    }
}
